var
	a,b,c:array[1 .. 100] of integer;
	na,nb,nc:integer;
	i,j,k,t:integer;
begin
	na:=0;
	while not eoln do
	begin
		inc(na);
		read(a[na]);
	end;
	readln;
	nb:=0;
	while not eoln do
	begin
		inc(nb);
		read(b[nb]);
	end;

	{合并}
	nc:=0;
	i:=1;
	j:=1;
	while(i<=na) and (j<=nb) do
	begin
		if(nc=0) then
		begin
			inc(nc);
			if(a[i]<b[j]) then
			begin
				c[nc]:=a[i];
				inc(i);
			end
			else
			begin
				c[nc]:=b[j];
				inc(j);
			end;
		end
		else
		begin
			if(a[i]<b[j])then
			begin
				t:=a[i];
				inc(i);
			end
			else
			begin
				t:=b[j];
				inc(j);
			end;
			if c[nc]<>t then
			begin
				inc(nc);
				c[nc]:=t;
			end;
		end;
	end;

	for k:=i to na do
	begin
		if a[k]<>c[nc] then
		begin
			inc(nc);
			c[nc]:=a[k];
		end;
	end;

	for k:=j to nb do
	begin
		if b[k]<>c[nc] then
		begin
			inc(nc);
			c[nc]:=b[k];
		end;
	end;

	for k:=1 to nc do
		write(c[k],' ');
end.
